﻿#region Usings

using System.Data.Entity.ModelConfiguration;
using Rail.Net.Core.Model;

#endregion

namespace Rail.Net.Data.Configuration
{
    public class RelationRuMap : EntityTypeConfiguration<RelationRu>
    {
        public RelationRuMap()
        {
            ToTable("RelationRus");
            HasKey(relationRu => relationRu.Id);

            Property(relationRu => relationRu.SequenceNumber).IsRequired();
            Property(relationRu => relationRu.Distance).IsRequired();
            Property(relationRu => relationRu.Serial).IsRequired();

            HasRequired(relationRu => relationRu.Ru).WithMany(ru => ru.RelationRus);
            HasRequired(relationRu => relationRu.Relation).WithMany(relation => relation.RelationRus);
        }
    }
}